home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ShareWare OnLine 2
/
ShareWare OnLine Volume 2 (CMS Software)(1993).iso
/
comm2
/
ter61.zip
/
PASCAL._XE
/
FON37_38.PAS
next >
Wrap
Pascal/Delphi Source File
|
1992-10-02
|
4KB
|
126 lines
Program Convert34353637_to_38;
{ A small Terminate utility to show how to upgrade the phonebook }
{ Structures are Copyrighted by Bo Bendtsen 1992 }
{$I PHONE.34}
{$I PHONE.38}
Var
PhoneFile,
NewPhoneFile : File;
P34 : PhoneRec34;
P38 : PhoneRec;
x : Word;
Procedure FatalError(s:string);
Begin
WriteLn('Fatal: '+s+#10#10);
Halt;
End;
Begin
If Paramcount=0 Then
Begin
WriteLn('Terminate phonebook upgrade tool from 0.34,0.35,0.36,0.37 --=> 0.38');
WriteLn(#10'Syntax: FON37_38 phonebook.fon');
Halt;
End;
FillChar(PHead34,Sizeof(PHead34),0); { old header }
FillChar(PHead,Sizeof(PHead),0); { new header }
Assign(PhoneFile,Paramstr(1));
{$I-} Reset(PhoneFile,1); {$I+}
If IOResult=0 Then
Begin
{ Read the header in the phone file }
{$I-} BlockRead(PhoneFile,PHead34,Sizeof(PHead34)); {$I+}
If IOResult<>0 Then FatalError('Error in start of phonebook');
If (PHead34.Version='0.38ß') And (ParamStr(2)<>'/O') Then
Begin
WriteLn('This is allready a 0.38 phonebook /O to overwrite warning');
Halt;
End;
Assign(NewPhoneFile,'TERMINAT.TMP');
{$I-} Rewrite(NewPhoneFile,1); {$I+}
If IOResult=0 Then
Begin
{ Move old structure to new structure }
PHead.Encrypted := PHead34.Encrypted ;
PHead.Seed := PHead34.Seed ;
PHead.Version := PHead34.Version ;
PHead.Comment := PHead34.Comment ;
PHead.Num := PHead34.Num ;
PHead.PhonePos := PHead34.PhonePos ;
PHead.ScrPos := PHead34.ScrPos ;
PHead.WritePos := PHead34.WritePos ;
PHead.RangeStart := PHead34.RangeStart ;
PHead.RangeStop := PHead34.RangeStop ;
{$I-} BlockWrite(NewPhoneFile,PHead,Sizeof(PHead)); {$I+}
If IOResult<>0 Then FatalError('Could not write header');
{ Read all records into structure }
For x:=1 to PHead34.Num Do
Begin
{$I-} BlockRead(PhoneFile,P34,Sizeof(P34)); {$I+}
Writeln(P34.Name);
If IOResult<>0 Then FatalError('Error in phonebook, maybe wrong version');
FillChar(P38,sizeof(P38),0);
P38.Name := P34.Name ;
P38.Number := P34.Number ;
P38.Baud := P34.Baud ;
P38.Parity := P34.Parity ;
P38.DataBits := P34.DataBits ;
P38.StopBits := P34.StopBits ;
P38.Script := P34.Script ;
P38.Terminal := P34.Terminal ;
P38.Protocol := P34.Protocol ;
P38.DialPrefix := P34.DialPrefix ;
P38.Password := P34.Password ;
P38.Open := P34.Open ;
P38.Closed := P34.Closed ;
P38.User := P34.User ;
P38.Comment1 := P34.Comment1 ;
P38.Comment2 := P34.Comment2 ;
P38.AutoLogon := P34.AutoLogon ;
P38.LogonChar := P34.LogonChar ;
P38.Translate := P34.Translate ;
P38.Capture := P34.Capture ;
P38.LocalEcho := P34.LocalEcho ;
P38.StripHigh := P34.StripHigh ;
P38.RcvdBSdest := P34.RcvdBSdest ;
P38.Color := P34.Color ;
P38.JulDate := P34.JulDate ;
P38.CalcMin := P34.CalcMin ;
P38.Connects := P34.Connects ;
P38.SecUsed := P34.SecUsed ;
P38.UploadKb := P34.UploadKb ;
P38.DownloadKb := P34.DownloadKb ;
P38.Costs := P34.Costs ;
{$I-} BlockWrite(NewPhoneFile,P38,Sizeof(P38)); {$I+}
If IOResult<>0 Then FatalError('Could not write entry');
End;
Close(NewPhoneFile);
Close(PhoneFile);
Erase(PhoneFile);
Rename(NewPhoneFile,ParamStr(1));
End;
End;
End.